package eu.gline.km.actors;

import java.io.IOException;

import eu.gline.km.clients.KmClient;
import eu.gline.km.jni.enums.bVk;
import eu.gline.km.jni.enums.dwFlags;
import eu.gline.km.protocol.PROTOCOL;

public class KeyboardActor {
	
	private KmClient kmClient;
	
	public KeyboardActor(KmClient kmClient) {
		this.kmClient = kmClient;
	}
	
	public void keyboardEvent(bVk bvk, dwFlags dwflags) {
		try {
			kmClient.getDos().writeInt(PROTOCOL.Keyboard);
			kmClient.getDos().writeInt(bvk.value());
			kmClient.getDos().writeInt(dwflags.value());
			kmClient.getDos().flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	public void foregroundWindow(String string) {
		try {
			kmClient.getDos().writeInt(PROTOCOL.SetForegroundWindow);
			kmClient.getDos().writeUTF(string);
			kmClient.getDos().flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
